<template>
  <div class="loginlist">
    <van-sticky>
      <div class="top">
        <div
          class="iconfont icon-arrowRight-copy-copy"
          @click="$router.push('/login')"
        ></div>
        <div></div>
        <div></div>
      </div>
    </van-sticky>

    <div class="midden">
      <div class="title">
        <h1>密码登录</h1>
        <h2>Hi,欢迎来到豆果美食，会做饭很酷~</h2>
      </div>
      <div class="form">
        <div class="item">
          <input type="text" placeholder="请输入手机号" v-model="phone" />
        </div>
        <div class="item">
          <span class="iconfont icon-search"></span>
          <input type="password" placeholder="请输入密码" v-model="password" />
        </div>
      </div>
      <div class="btn">
        <div class="submit" @click="submit">登录</div>
      </div>
    </div>
    <img src="../../assets/login.png" alt="" />
  </div>
</template>

<script>
import Vue from "vue";
import { Toast } from "vant";

Vue.use(Toast);
export default {
  data() {
    return {
      phone: "",
      password: "",
      code: "",
    };
  },
  methods: {
    submit() {
      // 1.验证手机号码
      let regPhone =
        /^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
      if (!regPhone.test(this.phone)) {
        Toast("请填写正确信息");
        return;
      } else {
        Toast("登陆成功");
        window.localStorage.setItem("token", 111);
        this.$router.push("/my");
      }
    },
  },
};
</script>

<style lang='less'>
.loginlist {
  .top {
    background: #fff;
    padding-bottom: 5px;
    margin: 0 20px;
    padding-top: 30px;
    margin-bottom: 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .iconfont {
      font-weight: bold;
      font-size: 20px;
    }
  }
  .midden {
    margin-left: 25px;
    h1 {
      font-size: 22px;
      margin-top: 20px;
    }
    h2 {
      margin-top: 11px;
      color: #9e9e9e;
      font-size: 12px;
    }
    input {
      width: 346px;
      color: #c6c6c6;
      font-size: 15px;
      margin-top: 26px;
      border: none;
      padding-bottom: 11px;
      border-bottom: 2px solid #f5f5f5;
    }
    .btn {
      text-align: center;
      margin-top: 36px;
      height: 38px;

      background: #f6c755;
      border-radius: 20px;
      margin-right: 14px;
      .submit {
        line-height: 38px;
      }
    }
    .item {
      display: flex;
      align-items: center;
      .getCode {
        border: 1px solid #fff;
        height: 20px;
        line-height: 20px;
        width: 50px;
        border-radius: 20px;
        font-size: 12px;
        color: #808080;

        margin: 5px;
      }
    }
  }
  img {
    width: 100%;
    margin-top: 190px;
  }
}
</style>